const Sequelize = require('sequelize');
module.exports = function(sequelize, DataTypes) {
  return sequelize.define('sunnyRoleScope', {
    id: {
      type: DataTypes.BIGINT,
      allowNull: false,
      primaryKey: true,
      comment: "主键"
    },
    scopeCategory: {
      type: DataTypes.INTEGER,
      allowNull: true,
      comment: "权限类型(1:数据权限、2:接口权限)",
      field: 'scope_category'
    },
    scopeId: {
      type: DataTypes.BIGINT,
      allowNull: true,
      comment: "权限id",
      field: 'scope_id'
    },
    roleId: {
      type: DataTypes.BIGINT,
      allowNull: true,
      comment: "角色id",
      field: 'role_id'
    }
  }, {
    sequelize,
    tableName: 'sunny_role_scope',
    timestamps: true,
    createdAt: 'createTime',
    updatedAt: 'updateTime',
    deletedAt: 'deleteTime',
    indexes: [
      {
        name: "PRIMARY",
        unique: true,
        using: "BTREE",
        fields: [
          { name: "id" },
        ]
      },
    ]
  });
};
